home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 235 / Issue 235 - September 2007 - DPCS0907DVD.ISO / Microsoft / Expression Blend / Blend.en.msi / Sparkle.AStudio.Pen.cs.en < prev    next >
Encoding:
Text (UTF-16)  |  2007-03-19  |  3.5 KB  |  62 lines

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.ComponentModel;
  5. using System.Windows.Media;
  6. using System.Windows.Ink;
  7.  
  8. namespace UntitledProject1
  9. {
  10.     /// <summary>
  11.     /// INotifyPropertyChanged allows that properties of the Class InkPen
  12.     /// participate as source in data bindings.
  13.     /// </summary>
  14.     public class InkPen : INotifyPropertyChanged
  15.     {
  16.         private Color penColor = Colors.Black;
  17.         private SolidColorBrush myBrush = new SolidColorBrush(Colors.Black);
  18.         private DrawingAttributes attributes = new DrawingAttributes();
  19.  
  20.         #region Public Attributes
  21.  
  22.         public DrawingAttributes Attributes
  23.         {
  24.             get
  25.             {
  26.                 this.attributes.Color = this.penColor;
  27.                 return this.attributes;
  28.             }
  29.         }
  30.  
  31.         public Brush InkBrush
  32.         {
  33.             get
  34.             {
  35.                 myBrush.Color = this.penColor;
  36.                 return myBrush;
  37.             }
  38.         }
  39.  
  40.         #endregion
  41.  
  42.         /// <summary>
  43.         /// INotifyPropertyChanged requires a property called PropertyChanged.
  44.         /// </summary>
  45.         public event PropertyChangedEventHandler PropertyChanged;
  46.  
  47.         /// <summary>
  48.         /// Fires the event for the property when it changes.
  49.         /// </summary>
  50.         private void OnPropertyChanged(string propertyName)
  51.         {
  52.             if (this.PropertyChanged != null)
  53.             {
  54.                 // In order to INotifyPropertyChanged to work it is necessary
  55.                 // that the property fires the event whenever it changes.
  56.                 this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
  57.             }
  58.         }
  59.  
  60.     }
  61. }
  62.